{% extends 'homepage.html' %}

{% block content %}

<style>
.output {
    margin:20px 0;
    text-align: center;
}
</style>

<script type="text/javascript" src="{{ url_for('emf.static', filename='elliptic_modular_form_util-functions.js') }}"></script>
<script type="text/javascript" src="{{ url_for('emf.static', filename='elliptic_modular_form_scripts.js') }}"></script>

<script type="text/javascript">
$(document).ready(function() {
 $("#calc-qexp-output").text(" {{ qexp }} ");
MathJax.Hub.Queue(['Typeset', MathJax.Hub, "calc-qexp-output"]);
});
</script>
<script type="text/javascript">
function qexp_handler(evt) {
   evt.preventDefault();
   var val = $("#qexp-input").val();
   $("#qexp-output").load("{{ url_for('emf.get_qexp', level=level,weight=weight,character=character,label=label)}}" + "?prec=" + val, 
     function() {
       {# tell mathjx to render the output #}
       MathJax.Hub.Queue(['Typeset', MathJax.Hub, "qexp-output"]);
     });
}
$(function() {
  $("#calc-qexp-go").click(function(e) {qexp_handler(e)});
  $("#calc-qexp-input").keypress(function(e) {
    if (e.which == 13) qexp_handler(e);
  });
  $( "#slider-qexp" ).slider({ value:2, min: 1, max: 5000, step: 1,
     change: function( event, ui ) {
               $( "#calc-qexp-input" ).val(ui.value );
  qexp_handler(event);
 }
  });
}


</script>


{% if error is defined %}
   {{ error | safe }}
{% else %}
<h1> {{ name | safe }} </h1>

<h2> {{ KNOWL('mf.elliptic.q-expansion',title='q-expansion')}}</h2>

  <div class="output">
    <span id="calc-qexp-output">
  </span>
  </div>
 <form>
{# action="{{url_for('emf.get_qexp', level=level,weight=weight,character=character,label=label)}}"> #}
   <input id="calc-qexp-input" name="prec" size=10 placeholder="10" value="10">
   <button id="calc-qexp-go">Go</button>
   <div class="slider" id="slider-qexp"></div>
 </form>
<p>


<p>
{{ polynomial_st | safe }}
<br>
{% if is_rational==0 %}
<h3>Embeddings</h3>
It is possible to embed the Fourier coefficients in the \(q\)-expansion above
in the field of complex numbers. The values are shown in the table below.

<table class="ntdata">
<thead>
  <tr><th>\(n\)</th>
    {% for n in range(1,embeddings_len) %}
    <th>{{n}}</th>
    {% endfor %}
  </tr>
</thead>
<tbody>
  {% for h in range(degree) %}
  <tr>
    <th style="border-right:solid black 1px">
      \( v_{{h}}(a(n)) \)
    </th>
    {% for n in range(1,embeddings_len) %}
    <td style="white-space:nowrap;">
      {{ embeddings[n][h] }}
    </td>
    {% endfor %}
  </tr>
  {% endfor %}
</tbody>
</table>
{% endif %}
<h2> Detailed data</h2>
<div>
  The first few {{KNOWL('mf.elliptic.satake_parameters',title='Satake parameters')}} \(\alpha_p\) and angles \(\theta_p = \textrm{Arg}(\alpha_p) \) are
</div>
<br>
{% if satake is defined %}
<table class="ntdata">
  <thead>
    <tr>
      <th>\( p \)</th>
      {% for ps in satake.ps %}
      <th> {{ps}}</th>
      {% endfor %}
    </tr>
  </thead>
  <tdata>
    {% for h in range(0,degree) %}
    {% if degree >1 %}
    <tr  style="border-top: solid black 1px">
      {% else %}
    <tr>
      {% endif %}  
      <th style="border-right: solid black 1px">
        \(\alpha_{p}\)
      </th>
      {% for ps in satake.ps %}
      <td>\( {{satake.alphas_latex[h][ps]}} \)</td>
      {% endfor %}
    </tr>
    <tr>
      <th style="border-right: solid black 1px">
        \(\theta_{p}\)
      </th>
      {% for ps in satake.ps %}
      <td> \( {{satake.thetas_latex[h][ps]}} \)</td>
      {% endfor %}
    </tr>
    {% endfor %}
  </tdata>
</table>
{% endif %}

{% if CM_values is defined %}
<h2>Special Values</h2>
<div>
  Values at some  {{ KNOWL('mf.elliptic.cm-points',title='CM points')}}
</div>
<p>
  <table class="ntdata" style="width:50%">
    <thead>
      <tr>
        <th width="20px" style="border-right:1px solid black">Point&nbsp;\&nbsp;Embedding</th>
        {% for h in CM_values.embeddings  %}
        <th width="{{ CM_values.max_width }}">{{ h |safe }}</th>
        {% endfor %}
      </tr>
    </thead>
    <tbody>
      {% for tau in CM_values.tau %}
      <tr>
        <th width="10px" style="border-right: 1px solid black">
          {{ CM_values.tau_latex[tau] |  safe }}
        </th>
        {% for h in CM_values.cm_vals[tau]  %}
        {% set vals =CM_values.cm_vals_latex[tau] %}
        <td width="50px">{{ vals[h] }}</td>
        {% endfor %}
        {% endfor %}            
      </tr>
    </tbody>
  </table>
</p>
{% endif %}

{% if explicit_formulas is defined %}
<h2> {{KNOWL('mf.elliptic.explicit_formula',title='')}}Explicit Formulas</h2>
	
{{ explicit_formulas }}

{% endif %}

{% if  true %}

<h2>Further Properties</h2>
<div>
  {% if is_cm is defined %}
  This newform is 
  {% if not is_cm[0] %}
  not
  {% endif %}
  a {{KNOWL('mf.elliptic.cm_form',title='CM form')}}.
  {% endif %}
  It is 
  {% if not is_minimal %}
  not
  {% endif %}
  {{KNOWL('mf.elliptic.minimal',title='minimal')}}.
</div>
{% if atkinlehner is defined and atkinlehner%}
<div>
  The function has {{KNOWL('mf.elliptic.atkinlehner',title='Atkin-Lehner')}} eigenvalues given by 
  <table class="ntdata">
    <thead>
      <tr>
        <th> \( Q \) </th>
        <th> Cusp </th>
        <th>Eigenvalue
      </tr>
    </thead>
    <tbody>
      {% for Q,c,ev in atkinlehner %}
      <tr>
        <th> {{Q}} </th>
        <th> {{ c }} </th>
        <td> {{ev}}</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
</div>
{% endif %}

<h2>Download Fourier coefficients</h2>
<form name="get_coefficients" method="post"  action="{{url_for('.render_elliptic_modular_forms')}}">
  <input type="hidden" name="download" value="coefficients">
  Get / compute  <input type="text" size="10" name="number" value="10"> 
  coefficients in the following format:
  <input type="hidden" name="level" value="{{level }}">
  <input type="hidden" name="character" value="{{character }}">
  <input type="hidden" name="weight" value="{{weight }}">
  <input type="hidden" name="label" value="{{label }}">
  <ul>
    <li> 
      <label><input type=radio name="format" checked value="q_expansion_one_line" onclick="return selectCFormat(event)"> q-expansion (on one line)</label>
    </li>
    <li> 
      <label><input type=radio name="format" checked value="q_expansion_table" onclick="return selectCFormat(event)"> q-expansion (table)</label>
    </li>
    <li>
      <label><input type=radio name="format" value="embeddings" onclick="return selectCFormat(event)"> Complex embeddings </label>
      with <input type="text" size="10" name="prec" value="15"> digits precision. 
    </li>
  </ul>
  <input type="button" name="Submit" value="Get coefficients" onclick="check_coefficient_form()">
</form>

<h2>Download as {{KNOWL('sage',title='Sage')}} Object</h2>
<form name="download_object_form" method="post"  action="{{url_for('.render_elliptic_modular_forms')}}">
  <input type="hidden" name="download" value="object">
  <input type="hidden" name="level" value="{{level }}">
  <input type="hidden" name="character" value="{{character }}">
  <input type="hidden" name="weight" value="{{weight }}">
  <input type="hidden" name="label" value="{{label }}">
  <input type="submit" name="Submit" value="Download" Onclick="document.download.submit()">
</form>
<div class="formexample"> 
<form name="download_file" method="post"  action="{{url_for('.render_elliptic_modular_forms')}}">
  Note: In order to use this data file you need to download and import
  <input type="hidden" name="download" value="file">
  <input type="hidden" name="download_file" value="web_modforms.py">
  <a href="javascript:void(0);" OnClick="document.download_file.submit()">web_modforms.py</a>
 </form>
</div>
{% endif %}
{% endif %}
</div>

{% endblock %}
